//
//  UIBarButtonItemExtend.m
//  xWeibo
//
//  Created by alvis mac on 8/4/15.
//  Copyright (c) 2015 alvis. All rights reserved.
//

#import "UIBarButtonItemExtend.h"
#import "UIImageExtend.h"
@implementation  UIBarButtonItem(UIBarButtonItemExtend)

+ (UIBarButtonItem *)itemWithIcon:(NSString *)icon highIcon:(NSString *)highIcon target:(id)target action:(SEL)action{
    UIButton *button=[[UIButton alloc] init];
    [button setBackgroundImage:[UIImage imageWithName:icon] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageWithName:highIcon] forState:UIControlStateHighlighted];
     button.frame=(CGRect){CGPointZero,button.currentBackgroundImage.size };
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return [[UIBarButtonItem alloc] initWithCustomView:button];
}
@end
